package com.example.flower_shop.vo.auth;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Schema(description = "登录返回信息")
public class AuthRespVO {
    @Schema(description = "JWT token")
    private String token;
    @Schema(description = "刷新token")
    private String refreshToken;
    @Schema(description = "用户ID")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long userId;
    @Schema(description = "过期时间戳")
    private Long expireAt;

    public static AuthRespVO of(String token, String refreshToken, Long userId) {
        return of(token, refreshToken, userId, 0);
    }

    public static AuthRespVO of(String token, String refreshToken, Long userId, long expireAt) {
        return new AuthRespVO(token, refreshToken, userId, expireAt);
    }
}
